package org.qloudgen.borg.pages.compnent;

import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.request.component.IRequestablePage;
import org.apache.wicket.request.mapper.parameter.PageParameters;

public class CancelButton extends Button{

	private static final long serialVersionUID = 1L;
	private Class<? extends IRequestablePage> pageClass;
	private PageParameters pp;

	public CancelButton(String id,Class<? extends IRequestablePage> pageClass , PageParameters pp) {
		super(id);
		this.pageClass = pageClass;
		this.pp = pp;
		this.setDefaultFormProcessing(false);
	}
	
	public CancelButton(String id,Class<? extends IRequestablePage> pageClass) {
		super(id);
		this.pageClass = pageClass;
		this.setDefaultFormProcessing(false);
	}

	public void onSubmit() {
		if (this.pp != null)
			setResponsePage(this.pageClass,this.pp);
		else
			setResponsePage(this.pageClass);
	}

}
